package com.qfedu.stussm.controller;

import com.qfedu.stussm.entity.Course1;
import com.qfedu.stussm.entity.Course3;
import com.qfedu.stussm.service.intf.Course1Service;
import com.qfedu.stussm.service.intf.Course3Service;
import com.qfedu.stussm.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api/cou3/")
public class Course3Controller {
    @Autowired
    private Course3Service service;
    @PostMapping("save.do")
    public String save(Course3 course3){
        service.add(course3);
        return "redirect:/course3list.html";
    }
    @GetMapping("page.do")
    @ResponseBody
    public PageBeanVo page(int page, int limit ,String c3_name){
        return service.selectAll(page, limit , c3_name);
    }
    @PostMapping("update.do")
    public String update(Course3 course3){
        int update = service.update(course3);
        return "course3list.html";
    }
    @PostMapping("del.do")
    public String del(int c3_id){
        int del = service.del(c3_id);
        return "course3list.html";
    }

}
